/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fri.entiry;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author NguyenDongUIT
 */
@Entity
@Table(name = "fr_history")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "FrHistory.findAll", query = "SELECT f FROM FrHistory f"),
    @NamedQuery(name = "FrHistory.findByHistoryId", query = "SELECT f FROM FrHistory f WHERE f.historyId = :historyId"),
    @NamedQuery(name = "FrHistory.findByContent", query = "SELECT f FROM FrHistory f WHERE f.content = :content"),
    @NamedQuery(name = "FrHistory.findByStatus", query = "SELECT f FROM FrHistory f WHERE f.status = :status"),
    @NamedQuery(name = "FrHistory.findByDateCreated", query = "SELECT f FROM FrHistory f WHERE f.dateCreated = :dateCreated")})
public class FrHistory implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 36)
    @Column(name = "HistoryId")
    private String historyId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 1000)
    @Column(name = "Content")
    private String content;
    @Basic(optional = false)
    @NotNull
    @Column(name = "Status")
    private int status;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DateCreated")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dateCreated;
    @JoinColumn(name = "UserId", referencedColumnName = "UserId")
    @ManyToOne(optional = false)
    private FrUser userId;

    public FrHistory() {
    }

    public FrHistory(String historyId) {
        this.historyId = historyId;
    }

    public FrHistory(String historyId, String content, int status, Date dateCreated) {
        this.historyId = historyId;
        this.content = content;
        this.status = status;
        this.dateCreated = dateCreated;
    }

    public String getHistoryId() {
        return historyId;
    }

    public void setHistoryId(String historyId) {
        this.historyId = historyId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public Date getDateCreated() {
        return dateCreated;
    }

    public void setDateCreated(Date dateCreated) {
        this.dateCreated = dateCreated;
    }

    public FrUser getUserId() {
        return userId;
    }

    public void setUserId(FrUser userId) {
        this.userId = userId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (historyId != null ? historyId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof FrHistory)) {
            return false;
        }
        FrHistory other = (FrHistory) object;
        if ((this.historyId == null && other.historyId != null) || (this.historyId != null && !this.historyId.equals(other.historyId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "fri.entiry.FrHistory[ historyId=" + historyId + " ]";
    }
    
}
